declare global {
  interface RouterMeta {
    title: string;
  }
  interface Router {
    path: string;
    name: string;
    icon?: string;
    permission?: string;
    meta?: RouterMeta;
    component: any;
    children?: Array<Router>;
  }
  interface System {
    import(request: string): Promise<any>;
  }
  const System: System
}

import main from '../views/main.vue'
import home from '../views/ui/home.vue'


export const locking = {
  path: '/locking',
  name: 'locking',
  component: () => import('../components/lockscreen/components/locking-page.vue')
}
export const loginRouter: Router = {
  path: '/login',
  name: 'login',
  meta: {
    title: 'LogIn'
  },
  component: () => import('../views/login.vue')
}
export const otherRouters: Router = {
  path: '/main',
  name: 'main',
  permission: '',
  meta: { title: 'ManageMenu' },
  component: main,
  children: [
    { path: 'home', meta: { title: 'HomePage' }, name: 'home', component: () => import('../views/home/home.vue') }
  ]
}
export const appRouters: Array<Router> = [{
  path: '/setting',
  name: 'setting',
  permission: '',
  meta: { title: 'ManageMenu' },
  icon: '&#xe68a;',
  component: main,
  children: [
    { path: 'user', permission: 'Pages.Users', meta: { title: 'Users' }, name: 'user', component: () => import('../views/setting/user/user.vue') },
    { path: 'role', permission: 'Pages.Roles', meta: { title: 'Roles' }, name: 'role', component: () => import('../views/setting/role/role.vue') },
    { path: 'tenant', permission: 'Pages.Tenants', meta: { title: 'Tenants' }, name: 'tenant', component: () => import('../views/setting/tenant/tenant.vue') }
  ]
}]

export const uiRouters = {
  path: '/',
  name: "ui",
  component: home,
  children: [
    { path: '/ui/affix', meta: { title: 'affix' }, name: 'affix', component: () => import('../views/ui/affix.vue') },
    { path: '/ui/alter', meta: { title: 'alter' }, name: 'alter', component: () => import('../views/ui/altertest.vue') },
  ]

}
export const routers = [
  loginRouter,
  locking,
  ...appRouters,
  otherRouters,
  uiRouters
]
